﻿#ifndef __INC_QG_DX9_DRAW_H__
#define __INC_QG_DX9_DRAW_H__

#ifdef _MSC_VER
#pragma once
#endif

//////////////////////////////////////////////////////////////////////////
// 버퍼
class DX9Buffer : public qgBuffer
{
	KCH_SUBCLASS(DX9Buffer, qgBuffer);
	KCH_FRIEND(DX9Device);

protected:
	kpointer			_lock;

	DWORD				_dx_usage;
	D3DPOOL				_dx_pool;

protected:
	DX9Buffer() throw() {}
	~DX9Buffer() throw() {}

protected:
	kint _ParseArpr(const qgArprBuffer& arpr, DX9Device* dev);
};

// 꼭지점 버퍼
class DX9BufferVertex : public DX9Buffer
{
	KCH_SUBCLASS(DX9BufferVertex, DX9Buffer);
	
protected:
	DX9BufferVertex() throw();
	~DX9BufferVertex() throw();

public:
	K_OVR kint KCALL Signal(const char* sig, kpointer arg);

	K_OVR kpointer EnterMap(kint flags);
	K_OVR bool LeaveMap();

	bool _Create(const qgArprBuffer& arpr, DX9Device* dev);
};

// 인덱스 버퍼
class DX9BufferIndex : public DX9Buffer
{
	KCH_SUBCLASS(DX9BufferIndex, DX9Buffer);

protected:
	DX9BufferIndex() throw();
	~DX9BufferIndex() throw();

public:
	K_OVR kint KCALL Signal(const char* sig, kpointer arg);

	K_OVR kpointer EnterMap(kint flags);
	K_OVR bool LeaveMap();

	bool _Create(const qgArprBuffer& arpr, DX9Device* dev);
};


//////////////////////////////////////////////////////////////////////////
// 레이아웃
class DX9Layout : public qgLayout
{
	KCH_SUBCLASS(DX9Layout, qgLayout);
	KCH_FRIEND(DX9Shader);

private:
	tpl::Array<D3DVERTEXELEMENT9> _descs;

private:
	DX9Layout() throw();
	~DX9Layout() throw();

public:
	bool _Create(qgLayoutData* data);

	static D3DDECLUSAGE _ConvSemanticUsage(qgDloUsage usage);
	static D3DDECLTYPE _ConvType(qgDloType type);
};

#endif	// __INC_QG_DX9_DRAW_H__
